#include "UnitTest.h"

#include <iostream>

std::vector<UnitTest*>	UnitTest::unitTests;
/*********************************************************/
UnitTest::UnitTest()
{
	unitTests.push_back(this);
}
/*********************************************************/
bool UnitTest::runAllTests()
{
	bool fail = false;
	try {
		for (unsigned int i=0; i<unitTests.size(); i++) {
			std::cout << std::endl;
			std::cout << "Testing Unit: " << unitTests[i]->name() << std::endl;
			if ( !unitTests[i]->runUnitTests() ) {
				fail = true;
			}
		}
	} catch(...) {
		std::cout << "Last Test failed with unhandled exception...!" << std::endl;
		return( false );
	}

	return( !fail );
}
/*********************************************************/
std::string UnitTest::name()
{
	return("Unnamed unit");
}
/*********************************************************/